View Javadoc
1 /*** 2 * EdgeFactory 3 * 4 * Implement this if you would like to be 5 * the class which provides edges to 6 * the ControlFlowGraph. 7 */ 8 9 package junit.quilt.cover.generic; 10 11 import org.apache.bcel.classfile.LineNumberTable; 12 import org.apache.bcel.generic.*; 13 14 public interface EdgeFactory { 15 /*** 16 * makeBranchEdge() 17 * 18 * Override this if you want to have a specific Branch 19 * Edge in your graph. 20 * 21 * @param source is the BlockVertex which contains the 22 * branch statement. 23 * 24 * @param target is the target BlockVertex of the branch. 25 * 26 * @param branch will contain as much of a description of the 27 * branch we can get. (i.e. "a < 0") 28 * 29 * @param value is the required value the condition needs to 30 * evaluate to to execute this branch edge. 31 */ 32 public FlowControlEdge makeBranchEdge(BlockVertex source, 33 BlockVertex target, 34 String branch, 35 boolean value); 36 37 /*** 38 * makeSelectEdge 39 * 40 * Override this method if you want to make a custom 41 * SelectEdge. 42 * 43 * @param source is the BlockVertex which contains 44 * the Select statement. 45 * 46 * @param target is the BlockVertex which is targeted 47 * by the Select statement. 48 * 49 * @param expr is the expression which is evaluated 50 * for the switch statement. (i.e. "a + b") 51 * 52 * @param value is the integer value which is required 53 * in order to execute this branch. 54 * 55 * (The second version, without the "value" param is 56 * called for the default value. 57 */ 58 public FlowControlEdge makeSelectEdge(BlockVertex source, 59 BlockVertex target, 60 String expr, 61 int value); 62 63 public FlowControlEdge makeSelectEdge(BlockVertex source, 64 BlockVertex target, 65 String expr); 66 67 /*** 68 * makeExceptionEdge() 69 * 70 * Override this method if you want to make a special 71 * exception edge. 72 * 73 * @param source is the BlockVertex which contains the 74 * exception thrower. 75 * 76 * @param handler is the BlockVertex which acts as this 77 * exception handler. 78 * 79 * @param exceptions is the set of exceptions which are 80 * caught by the exception handler. 81 * 82 * In the second variation, without the handler, it 83 * represents an unhandled exception. 84 */ 85 public FlowControlEdge makeExceptionEdge(BlockVertex source, 86 BlockVertex handler, 87 Class exception); 88 89 public FlowControlEdge makeExceptionEdge(BlockVertex source, 90 Class exception); 91 92 public FlowControlEdge makeExceptionEdge(BlockVertex source, 93 BlockVertex handler, 94 ObjectType exception); 95 96 public FlowControlEdge makeExceptionEdge(BlockVertex source, 97 ObjectType exception); 98 99 /*** 100 * makeNormalEdge() 101 * 102 * Override this method if you want to make a special 103 * normal edge. 104 * 105 * A Normal Edge is used when there is only normal 106 * flow of control. (No branching or exceptions.) 107 * 108 * Just because you have a normal edge though, does 109 * not mean that the source and target fall under 110 * the same basic block. This edge may very well 111 * be a target from a previous branch. 112 * 113 * @param source is the first BlockVertex in sequence. 114 * @param target is the second BlockVertex in sequence. 115 */ 116 public FlowControlEdge makeNormalEdge(BlockVertex source, 117 BlockVertex target); 118 119 /*** 120 * makeJSREdge() 121 * 122 * This returns an edge generated by a JSR instruction. 123 */ 124 public FlowControlEdge makeJSREdge(BlockVertex source, 125 BlockVertex target); 126 127 /*** 128 * makeReturnEdge 129 * 130 * This is called when a Return statement happens. 131 * 132 * @param source is the BlockVertex which contains 133 * the return. 134 */ 135 public FlowControlEdge makeReturnEdge(BlockVertex ret); 136 137 /*** 138 * makeDummyEdge 139 * 140 * This is used to add a dummy edge into the graph. 141 * It will never make it into Bytecode. 142 */ 143 public FlowControlEdge makeDummyEdge( BlockVertex start, 144 BlockVertex end ); 145 146 /*** 147 * makeBlockVertex() 148 * 149 * Override this method if you want to provide a special 150 * implementation of a block vertex. 151 * 152 * A BlockVertex represents a collection of OpCodes which 153 * have no branches or exceptions in them. (Except for 154 * the last member of the BlockVertex. 155 * 156 * @param lineNumberTable is the line number table for 157 * the method. It can use this to determine which 158 * lines the block includes. It may be NULL. 159 * 160 * A BlockVertex is responsible for holding all of the 161 * instruction handles in the graph. 162 */ 163 public BlockVertex makeBlockVertex(LineNumberTable lineNumberTable); 164 165 /*** 166 * makeStartVertex 167 * 168 * This will create a new vertex which acts as 169 * the entry point into the method. 170 * 171 * This gives a location for initialization code. 172 * 173 * No LineNumberTable is provided, because there are 174 * no line numbers for added code. 175 */ 176 public InitVertex makeStartVertex(); 177 178 /*** 179 * makeEndVertex 180 * 181 * This will create a single exit point from 182 * the graph. This will help us in adding 183 * a finally statement, I believe. 184 */ 185 public FinallyVertex makeEndVertex(); 186 187 } 188 189 190

This page was automatically generated by Maven